/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mapping;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "componentes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Componentes.findAll", query = "SELECT c FROM Componentes c"),
    @NamedQuery(name = "Componentes.findById", query = "SELECT c FROM Componentes c WHERE c.id = :id"),
    @NamedQuery(name = "Componentes.findByCaracteristicas", query = "SELECT c FROM Componentes c WHERE c.caracteristicas = :caracteristicas"),
    @NamedQuery(name = "Componentes.findByStatus", query = "SELECT c FROM Componentes c WHERE c.status = :status")})
public class Componentes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "caracteristicas")
    private String caracteristicas;
    @Basic(optional = false)
    @Column(name = "status")
    private String status;
    @OneToMany(mappedBy = "idComponenteCambio")
    private Collection<CambioComp> cambioCompCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "componentes")
    private Collection<CambioComp> cambioCompCollection1;
    @JoinColumn(name = "idTipo", referencedColumnName = "idTipo")
    @ManyToOne(optional = false)
    private TipoDisp idTipo;
    @JoinColumn(name = "idDispActual", referencedColumnName = "idDisp")
    @ManyToOne
    private Dispositivo idDispActual;
    @JoinColumn(name = "idDispOrigen", referencedColumnName = "idDisp")
    @ManyToOne
    private Dispositivo idDispOrigen;

    public Componentes() {
    }

    public Componentes(Integer id) {
        this.id = id;
    }

    public Componentes(Integer id, String caracteristicas, String status) {
        this.id = id;
        this.caracteristicas = caracteristicas;
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCaracteristicas() {
        return caracteristicas;
    }

    public void setCaracteristicas(String caracteristicas) {
        this.caracteristicas = caracteristicas;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @XmlTransient
    public Collection<CambioComp> getCambioCompCollection() {
        return cambioCompCollection;
    }

    public void setCambioCompCollection(Collection<CambioComp> cambioCompCollection) {
        this.cambioCompCollection = cambioCompCollection;
    }

    @XmlTransient
    public Collection<CambioComp> getCambioCompCollection1() {
        return cambioCompCollection1;
    }

    public void setCambioCompCollection1(Collection<CambioComp> cambioCompCollection1) {
        this.cambioCompCollection1 = cambioCompCollection1;
    }

    public TipoDisp getIdTipo() {
        return idTipo;
    }

    public void setIdTipo(TipoDisp idTipo) {
        this.idTipo = idTipo;
    }

    public Dispositivo getIdDispActual() {
        return idDispActual;
    }

    public void setIdDispActual(Dispositivo idDispActual) {
        this.idDispActual = idDispActual;
    }

    public Dispositivo getIdDispOrigen() {
        return idDispOrigen;
    }

    public void setIdDispOrigen(Dispositivo idDispOrigen) {
        this.idDispOrigen = idDispOrigen;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Componentes)) {
            return false;
        }
        Componentes other = (Componentes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mapping.Componentes[ id=" + id + " ]";
    }
    
}
